package com.itgungnir.designpattern.state;

public class noCandyState implements State {
	private CandyMachine candyMachine;

	public noCandyState(CandyMachine candyMachine) {
		this.candyMachine = candyMachine;
	}

	@Override
	public void onMoneyInserted() {
		System.out.println("已经没有糖果了！");
		onMoneyReturned();
	}

	@Override
	public void onMoneyReturned() {
		System.out.println("投币退回！");
		candyMachine.setState(candyMachine.getNoMoneyState());
	}

	@Override
	public void onCrankTurned() {
		System.out.println("已经没有糖果了！操作无效");
		onMoneyReturned();
	}

	@Override
	public void onCandyPoped() {
		System.out.println("已经没有糖果了！");
		onMoneyReturned();
	}
}